<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<?php
include_once '../Login/databaseconnection.php';

if(!loggedin())
{
	require_once '../index.php';
}
   
   else
   {
	
$First_Name=$_POST['First_Name'];
  $Last_Name=$_POST['Last_Name'];
 $NIC_Number=$_POST['NIC_Number'];
   $E_Mail=$_POST['E_Mail'];
   $Login_Username=$_POST['Login_Username'];
    $Password=$_POST['Password'];
$PasswordVar=$_POST['PasswordVar'];
$PasswordVar=$_POST['PasswordVar'];

 $_SESSION['First_Name']=$First_Name;
 $_SESSION['Last_Name']=$Last_Name;
 $_SESSION['NIC_Number']=$NIC_Number;
 $_SESSION['E_Mail']=$E_Mail;
 $_SESSION['Login_Username']=$Login_Username;

if($First_Name!=""&&$Last_Name!=""&&$NIC_Number!=""&&$E_Mail!=""&&$Login_Username!=""&&$Password!="")
	{
	 if($PasswordVar=="")
 {
 $_SESSION['errorvari']="Please Varify your Password!";
 }
 if($PasswordVar!="")
 {
if($Password!=$PasswordVar)
{
$_SESSION['errorvarfai']="Your varification is failed please try again!";
}
}
}
if($Password==$PasswordVar)
{
if($First_Name!=""&&$Last_Name!=""&&$NIC_Number!=""&&$E_Mail!=""&&$Login_Username!=""&&$Password!="")
	{
	 $md5pass=md5($Password);
$sql=mysql_query("INSERT INTO user(First_Name,Last_Name,NIC_Number,E_Mail,Login_Username,Password)values('$First_Name','$Last_Name','$NIC_Number','$E_Mail','$Login_Username','$md5pass)");
if($sql)
  {
//$_SESSION['error']="This record is successfully registered!";
 unset($_SESSION['NIC_Number']);
 unset($_SESSION['E_Mail']);
 unset($_SESSION['Login_Username']);
require_once 'index.php';

  }

  if(!$sql)
  {
$_SESSION['error']="Sorry unable to register this record!";

  }
  }
  if($First_Name==""||$Last_Name==""||$NIC_Number==""||$E_Mail==""||$Login_Username==""||$Password=="")
	{
	$_SESSION['errorin']="Please fill all!";
  }
  }
   }
?>
</body>
</html>
